﻿<html class="hb-loaded"><head>
	<meta charset="utf-8">
	<title>会员注册</title>
        <meta name="Keywords" content="Darry Ring钻戒价格,Darry Ring钻戒图片">
    <meta name="Description" content="Darry Ring官网会员注册登录唯一入口，Darry Ring是求婚钻戒第一品牌，想了解Darry Ring实体店、Darry Ring哪里有卖等相关Darry Ring资讯就先进入戴瑞珠宝官网注册吧！">
    <link href="css/style.css" type="text/css" rel="stylesheet">
</head>

<body>
    <div class="wrap">
		<!-- start of 头部导航-->
	<div class="head_top">
        <div class="head clearfix">
            <!--头部左边-->
            <div class="topLeft left">
                <a href="../home/home.html" title="Darry Ring">
                    <img width="186" height="42" src="image/logo_01.png ">
                </a>
                <span>求婚钻戒领导品牌</span>
            </div>
            <!--头部左边end-->
            <!--头部右边-->
            <ul class="topRight right">
                <li>国际权威认证</li>
                <li class="tr_2">15天无理由退换</li>
                <li class="tr_3">终身保养</li>
            </ul>
            <!--头部左边end-->
        </div>
    </div>
    <!--end of 头部导航-->
    <!-- starto of container -->
	<div class="container">
        <!--中间内容-->
        <div class="cmain ddd">
            <!--内容右边-->
            <div class="cort-right right">
            	<div class="r_bg"></div>
                <!--登陆框内-->
                <div class="cr_border">
                    <div class="tits">
                        <span class="em"><em></em>邮箱注册</span>
                    </div>
                    <!--邮箱注册-->
                    <form method="post" action="/RegisterServlet" class="form_first">
                    <input type="hidden" value="2" name="type">
                    <input type="hidden" value="login.html" name="forward">
                    <div style="" class="photo_show">

                        <!--用户名-->
                        <div class="the_input ">
                            <span class="usName"></span>
                            <input type="text" placeholder="请输入用户名" class="al_Input dr_photo" id="userName" value="" name="userName">
                        </div>
                        <!--用户名end-->

                        <!--邮箱-->
                        <div class="the_input ">
                           <span class="member"></span>
                           <input type="email" placeholder="请输入邮箱" class="al_Input dr_photo" value="" name="email">
                        </div>
                        <!--邮箱end-->
                        
                        <!--密码-->
                        <div class="the_input ">
                           <span class="pw"></span>
                           <input type="password" placeholder="请输入密码" maxlength="21" class="al_Input dr_photo" value="" name="email_pwd">
                        </div>
                        <!--密码end-->

                        <!--密码-->
                        <div class="the_input ">
                           <span class="pw"></span>
                           <input type="password" placeholder="确认密码" maxlength="21" class="al_Input dr_photo" value="" name="email_pwd_confirm">
                        </div>
                        <!--密码end-->
                        <div class="other_input">
                        <div class="left">
                            <input type="checkbox" id="email_check" name="email_check">
                            <label for="email_check">已经仔细阅读并同意<a target="_self" href="#">《Darry Ring用户注册协议》</a></label>
                        </div>
                        </div>
                        
                        <!--其他合作-->
                        <div class="other_hz">
                            <input type="button" value="立即注册" id="email_reg" class="up">
                        </div>
                        <!--其他合作end-->
                    </div>
                    </form>
                         <div><span style="font-size: 12px; display: inline-block;padding-top: 10px;float:left;margin-left: 176px; ">已经有账号，</span><span style="color: #8e4f1b; font-size: 12px; display: inline-block; float: right; margin-right: 42px; padding-top: 10px;"><a href="login.html">立即登录</a></span></div>
                    <!--邮箱注册end-->
                </div>
                <!--登陆框内end-->
            </div>
            <!--内容右边end-->
        </div>
        <!--中间内容end-->
    </div>
    <!-- end of container -->

        <!--底部end-->
    <div class="cmain bc_yz">
        <div class="db_cort">
            <p>Copyright &copy; 2006-2015  戴瑞珠宝 All Rights Reserved. 粤ICP备XXX号</p>
            <p>中国互联网违法信息举报中心 | 中国公安网络110报警服务 | 本网站提供所售商品的正式发票</p>
        </div>
    </div>
    </div>

    <script src="../js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
        $(function() {
            //验证参数
            $("#email_reg").click(function () {
                $('.ts_wrong').remove();
                $('.al_Input').removeClass('error');
                    //邮箱登录
                    var name = $("#userName").val();
                    var email = $('input[name="email"]').val();
                    var pwd = $('input[name="email_pwd"]').val();
                    var pwdConfirm = $('input[name="email_pwd_confirm"]').val();
                    var emailType = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/;

                if (name == '') {
                    var notice = '<div class="ts_wrong"><span id="wrong">请输入用户名！</span></div>';
                    $('input[name="userName"]').parent().after(notice);
                    $('input[name="userName"]').addClass('error');
                    return false;
                }

                    if (email == '') {
                        var notice = '<div class="ts_wrong"><span id="wrong">请输入邮箱！</span></div>';
                        $('input[name="email"]').parent().after(notice);
                        $('input[name="email"]').addClass('error');
                        return false;
                    }else if (emailType.test(email) == false){
                        var notice = '<div class="ts_wrong"><span id="wrong">邮箱格式错误 请重新输入！</span></div>';
                        $('input[name="email"]').parent().after(notice);
                        $('input[name="email"]').addClass('error');
                        return false;
                    }

                    if (pwd == '') {
                        var notice = '<div class="ts_wrong"><span id="wrong">请输入密码！</span></div>';
                        $('input[name="email_pwd"]').parent().after(notice);
                        $('input[name="email_pwd"]').addClass('error');
                        return false;
                    }

                    if (pwd.length < 6) {
                        var notice = '<div class="ts_wrong"><span id="wrong">密码长度为6~21个字符！</span></div>';
                        $('input[name="email_pwd"]').parent().after(notice);
                        $('input[name="email_pwd"]').addClass('error');
                        return false;
                    }

                    if (pwdConfirm == '') {
                        var notice = '<div class="ts_wrong"><span id="wrong">请输入确认密码！</span></div>';
                        $('input[name="email_pwd_confirm"]').parent().after(notice);
                        $('input[name="email_pwd_confirm"]').addClass('error');
                        return false;
                    }

                    if (pwd != pwdConfirm) {
                        var notice = '<div class="ts_wrong"><span id="wrong">密码与确认密码不一致 请重新输入！</span></div>';
                        $('input[name="email_pwd_confirm"]').parent().after(notice);
                        $('input[name="email_pwd_confirm"]').addClass('error');
                        return false;
                    }

                    if (!$('input[name="email_check"]').is(':checked')) {
                        var notice = '<div class="ts_wrong"><span id="wrong">请阅读并同意用户注册协议！</span></div>';
                        $('input[name="email_check"]').parent().parent().after(notice);
                        return false;
                    }

                $.getJSON("http://localhost:8080/DiamondRing/RegisterServlet","name="+name+"&email="+email+"&pwdConfirm="+pwdConfirm,function (data) {
                    if (data == 1){
                        alert("注册成功!");
                        location.href = "login.html"
                    }else if(data == 0){
                        alert("改邮箱已被注册!");
                    }else{
                        alert("注册失败");
                    }
                });
            });
        });

        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                if($('.ph').hasClass('focus')) {
                    $('#mobile_reg').click(ag_Reg_click_Mobile);
                }
                if($('.em').hasClass('focus')) {
                            $('#email_reg').click(ag_Reg_click_Email);
                }
            }
            // else {
            //$('#email_reg').click(ag_Reg_click_Email);
            // }
        });

    </script>
    </body>
</html>